﻿@model CmsAdminSiteModel

@helper DualListBox(string availableListBoxClass, string selectedListBoxClass, IEnumerable<SelectListItem> availableItems, IEnumerable<SelectListItem> selectedItems)
{
<fieldset class="b-dual-list">
    <div class="b-dual-list__chooser">
        <h4>Available users</h4>
        @Html.ListBox("AvailableUsers", availableItems, new { @class = @availableListBoxClass })
    </div>
	<div class="b-dual-list__controls">
        <input class="b-button" id="btnAdd" type="button" value=" > " />
        <input class="b-button" id="btnRemove" type="button" value=" < " />	
	</div>
    <div class="b-dual-list__chooser">
        <h4>Selected users</h4>
        @Html.ListBox("SelectedUsers", selectedItems, new { @class = @selectedListBoxClass })
    </div>
</fieldset>	
}

<h1 class="g-clear">
	<i class="b-icon b-icon_h b-icon_h_pages"></i>
	<span class="b-overflow">
		@ViewBag.Title
	</span>  
</h1>

@using (Html.BeginForm())
{
    <input type="hidden" value="@Model.Id"/>
    <div class="primary-content">
        <div class="b-form b-form_bordered b-form_theme_white">
            <div class="b-form__head g-clear">
                <h3 class="b-form__title">Microsite details</h3>
            </div>
            <div class="b-form__body">
                <fieldset class="b-form b-form_nopad">
                    <ol class="b-form__rows ul-reset g-clear">
                        @if (Model.IsCloneMode)
                        {
                            <li class="b-form__row g-clear">
                                <label for="SiteToCloneId">Site to clone</label>
                                @Html.DropDownListFor(e => e.SiteToCloneId, new SelectList(Model.AllSites, "Id", "SiteName"))
                            </li>
                        }
                        
                        <li class="b-form__row g-clear">
                            <label for="SiteName">Site name</label>
                            @Html.TextBoxFor(p => p.SiteName, new { @class = "text" })
                            @Html.ValidationMessageFor(p => p.SiteName)
                        </li>

                        <li class="b-form__row g-clear">
                            <label for="SiteUrl">Website URL (Live)</label>
                            @Html.TextBoxFor(p => p.SiteUrl, new { @class = "text" })
                            @Html.ValidationMessageFor(p => p.SiteUrl)
                        </li>

                        <li class="b-form__row g-clear">
                            <label for="SiteGroupId">Site group</label>
                            @Html.DropDownListFor(e => e.SiteGroupId, new SelectList(Model.SiteGroups, "Id", "SiteGroupName"))
                        </li>                        
                    </ol>
                </fieldset>
            </div>
        </div>

        <div class="b-form b-form_bordered b-form_theme_white">
            <div class="b-form__head g-clear">
                <h3 class="b-form__title">Assign users to this site</h3>
            </div>
            <div class="b-form__body">
                @DualListBox("available-items", "selected-items", new SelectList(Model.AllUsers, "Id", "UserName"), new SelectList(Model.AssignedUsers, "Id", "UserName"))
            </div>
        </div>
        <input type="submit" class="b-button" value="submit" title="Create"/>

    </div>
}
